package com.oldroid.apps.getit.ui.adapter;

import com.oldroid.apps.getit.ui.DownloadsFragment;
import com.oldroid.apps.getit.ui.TagsFragment;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

/**
 * Starred Display starred files 1: All downloads (can be changed) Display all
 * files(deleted files won't be displayed) 2: Tags List of tags (users can edit
 * tags or filter files with a tag)
 * 
 * @author CaptainPark
 * 
 */
public class ViewPagerFragmentAdapter extends FragmentPagerAdapter {
	private static final String TAG = "ViewPagerFragmentAdapter";
	static final int INDEX_STARRED = 0;
	static final int INDEX_DOWNLOADS = 1;
	static final int INDEX_TAGS = 2;

	public ViewPagerFragmentAdapter(FragmentManager fm) {
		super(fm);
		// TODO Auto-generated constructor stub
	}

	@Override
	public Fragment getItem(int position) {
		switch (position) {
		case INDEX_STARRED:
			return DownloadsFragment.newInstance(true);
		case INDEX_DOWNLOADS:
			return DownloadsFragment.newInstance(false);
		case INDEX_TAGS:
			return new TagsFragment();
		default:
			throw new IllegalArgumentException("Unknown Position at " + position);
		}

	}

	@Override
	public int getCount() {
		return INDEX_TAGS + 1;
	}

}
